﻿/*
作者：魏铁雷
时间：209-11-20
功能：模块列表显示
**/
var ModelId = "";
var PageSize = 12;
var ArrList = new Array();
var page = 1;
function ShowMain() {
    //GetModelList(1);
    page = request("page")
    ModelId = request("ModelId")
    if (page == undefined || page == "") {
        page = 1;
        GetModelList(1);
    }
    else {
        page = request("page");
        GetModelList(page);
    }
}

function SelectAll(id, name)//全选
{
    var checks = document.getElementsByTagName("input");
    for (var i = 0; i < checks.length; i++) {
        if (checks[i].name == name) {
            checks[i].checked = document.getElementById(id).checked;
        }
    }
};

function SelectIDs(name) {
    var checks = document.getElementsByTagName("input");
    var str = "";
    for (var i = 0; i < checks.length; i++) {
        if (checks[i].name == name && checks[i].checked) {
            str += checks[i].value + ",";
        }
    }
    return str;
};

//获取"栏目列表"
function GetModelList(page) {
    ModelId = request("ModelId");
    indexpage = page;
    var url = encodeURI(SBasePath + '/action/DiaoCha/DiaoChaList1.aspx');
    var pars = encodeURI("?PageIndex=" + page + "&PageSize=" + PageSize + "&ModelId=" + ModelId);
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sGetModelList, onFailure: fGetModelList });
}
//获取"栏目列表"成功
function sGetModelList(o) {
    ArrList = MapDiaoCha(o);
    Total = MapPage(o, "RecordCount");
    PageIndex = MapPage(o, "PageIndex");
    PageTotal = Math.ceil(Total / PageSize)
    ShowContent();
    }

function fGetModelList(o) {
}
//----------------------------显示列表---------------------------------------
function ShowContent() {
    var str = "";

    str += '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">'
    str += '        <tr>';
    str += '            <td height="30">';
    str += '                <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '                    <tr>';
    str += '                        <td width="15" height="30">';
    str += '                            <img src="../../img/tab_03.gif" width="15" height="30" />';
    str += '                        </td>';
    str += '                        <td width="1101" background="../../img/tab_05.gif">';
    str += '                            <img src="../../img/311.gif" width="16" height="16" />';
    str += '                            <span class="title1">网上调查列表</span>';
    str += '                        </td>';
    str += '                        <td width="281" background="../../img/tab_05.gif">';
    str += '                            <table border="0" align="right" cellpadding="0" cellspacing="0">';
    str += '                                <tr>';
    str += '                                    <td width="60">';
    str += '                                        <table width="87%" border="0" cellpadding="0" cellspacing="0">';
    str += '                                            <tr>';
    str += '                                                <td>';
    str += '                                                    <div align="center">';
    str += '                                                        <input id="ChkAll" type="checkbox" onclick=\'SelectAll("ChkAll","ChkAllValue")\' />';
    str += '                                                </td>';
    str += '                                                <td>';
    str += '                                                    <div align="center" class="f_green">全选</div>';
    str += '                                                </td>';
    str += '                                            </tr>';
    str += '                                        </table>';
    str += '                                    </td>';
    str += '                                    <td width="60">';
    str += '                                        <table width="90%" border="0" cellpadding="0" cellspacing="0">';
    str += '                                            <tr>';
    str += '                                                <td>';
    str += '                                                    <div align="center">';
    str += '                                                        <img src="../../img/001.gif" width="14" height="14" /></div>';
    str += '                                                </td>';
    str += '                                                <td>';
    str += '                                                    <div align="center" class="f_green"><a style="cursor: hand" onclick="javascript:GetList_add1(\''+(Total*1+1)+'\')">新增</a></div>';
    str += '                                                </td>';
    str += '                                            </tr>';
    str += '                                        </table>';
    str += '                                    </td>';
    str += '                                    <td width="52">';
    str += '                                        <table width="88%" border="0" cellpadding="0" cellspacing="0">';
    str += '                                            <tr>';
    str += '                                                <td>';
    str += '                                                    <div align="center">';
    str += '                                                        <img src="../../img/083.gif" width="14" height="14" /></div>';
    str += '                                                </td>';
    str += '                                                <td>';
    str += '                                                    <div align="center" class="f_green"><a style="cursor: hand" onclick="javascript:DelModels(\'ChkAllValue\')">删除</a></div>';
    str += '                                                </td>';
    str += '                                            </tr>';
    str += '                                        </table>';
    str += '                                    </td>';
    str += '                                </tr>';
    str += '                            </table>';
    str += '                        </td>';
    str += '                        <td width="14">';
    str += '                            <img src="../../img/tab_07.gif" width="14" height="30" />';
    str += '                        </td>';
    str += '                    </tr>';
    str += '                </table>';
    str += '            </td>';
    str += '        </tr>';
    str += '        <tr>';
    str += '            <td>';
    str += '                <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '                    <tr>';
    str += '                        <td width="9" background="../../img/tab_12.gif"> &nbsp;</td>';
    str += '                        <td bgcolor="#f3ffe3">';
    str += '                            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98">';
    str += '                                <tr>';
    str += '                                    <td width="6%" height="26" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">选择</div> ';
    str += '                                    </td>';
    str += '                                    <td width="8%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">序号</div>';
    str += '                                    </td>';
    str += '                                    <td width="30%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">调查主题</div>';
    str += '                                    </td>';
    str += '                                    <td width="10%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">总投票数</div>';
    str += '                                    </td>';
    str += '                                    <td width="10%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">当前状态</div>';
    str += '                                    </td>';
    str += '                                    <td width="10%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">调查类别</div>';
    str += '                                    </td>';
    str += '                                    <td width="10%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">排序编号</div>';
    str += '                                    </td>';
    str += '                                    <td width="7%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">编辑</div>';
    str += '                                    </td>';
    str += '                                    <td width="7%" height="18" background="../../img/tab_14.gif">';
    str += '                                        <div align="center" class="f_green">删除</div>';
    str += '                                    </td>';
    str += '                                </tr>';
    for (var i = 0; i < ArrList.length; i++) {
        str += '                                <tr class="bg_w" onmouseout="this.className=\'bg_w\'" onmouseover="this.className=\'bg_g\'">';
        str += '                                    <td height="18">';
        str += '                                        <div align="center">';
        str += '                                            <input name="ChkAllValue" type="checkbox" value="' + ArrList[i].Id + '" />';
        str += '                                        </div>';
        str += '                                    </td>';
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content">' + (PageSize*(PageIndex-1) +i + 1) + '</div>';
        str += '                                    </td>';
        str += '                                    <td height="18" class="style1">';
        str += '                                        <div align="center" class="content"><a style="cursor: hand" onclick="javascript:Models(\'' + ArrList[i].Id + '\',\'' + ArrList[i].question_item + '\')">' + ArrList[i].question_item + '</a></div>';
        str += '                                    </td>';
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content"> <a style="cursor: hand" onclick="javascript:Models(\'' + ArrList[i].Id + '\',\'' + ArrList[i].question_item + '\')">' + ArrList[i].num + '</a></div>';
        str += '                                    </td>';
        if (ArrList[i].active == "1") {
            str += '                                    <td height="18">';
            str += '                                        <div align="center" class="content">';
            str += '                                            启用</div>';
            str += '                                    </td>';
        } else {
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content">';
        str += '                                            禁用</div>';
        str += '                                    </td>';
    }
    if (ArrList[i].type == "1") {
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content">';
        str += '                                            单选</div>';
        str += '                                    </td>';
    } else {
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content">';
        str += '                                            多选</div>';
        str += '                                    </td>';
    }
        
        str += '                                    <td height="18">';
        str += '                                        <div align="center" class="content">';
        str += '                                            ' + ArrList[i].DisplayOrder + '</div>';
        str += '                                    </td>';
        str += '                                    <td height="18">';
        str += '                                        <div align="center">';
        str += '                                            <span>';
        str += '                                                <img src="../../img/037.gif" width="9" height="9" /></span><span> [</span><a href="javascript:GetList_edit1(\'' + ArrList[i].Id + '\',\'' + ArrList[i].question_item + '\',\'' + ArrList[i].DisplayOrder + '\',\'' + ArrList[i].type + '\',\'' + ArrList[i].active + '\',\'' + ArrList[i].start_date + '\',\'' + ArrList[i].end_date + '\')" >编辑</a><span>]</span></div>';
        str += '                                    </td>';
        str += '                                    <td height="18">';
        str += '                                        <div align="center">';
        str += '                                            <span>';
        str += '                                                <img src="../../img/010.gif" width="9" height="9" /></span><span> [</span><a href="javascript:DelModels(\'' + ArrList[i].Id + '\')">删除</a><span>]</span></div>';
        str += '                                    </td>';
        str += '                                </tr>';
    }
    str += '                            </table>';
    str += '                        </td>';
    str += '                        <td width="9" background="../../img/tab_16.gif">&nbsp;</td>';
    str += '                    </tr>';
    str += '                </table>';
    str += '            </td>';
    str += '        </tr>';
    
    str += '        <tr>';
    str += '            <td height="29">';
    str += '                <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '                    <tr>';
    str += '                        <td width="15" height="29">';
    str += '                            <img src="../../img/tab_20.gif" width="15" height="29" />';
    str += '                        </td>';
    str += '                        <td background="../../img/tab_21.gif">';
    str += '                            <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '                                <tr>';
    str += '                                    <td width="25%" height="29" nowrap="nowrap">';
    str += '                                        <span class="f_green">共' + Total + '条记录, 当前第' + PageIndex + '/' + PageTotal + '页,每页' + PageSize + '条纪录</span>';
    str += '                                    </td>';
    str += '                                    <td width="75%" valign="top">';
    str += '                                        <div align="right">';
    if (PageTotal > 1) {
        
        str += '                                            <table width="352" height="20" border="0" cellpadding="0" cellspacing="0">';
        str += '                                                <tr>';
        str += '                                                    <td width="62" height="22" valign="middle">';
        str += '                                                        <div align="right">';
        str += '                                                          <a href="javascript:void(0)" onclick="FirstPage(\'GetModelList\')"><img src="../../img/first.gif" border="0" width="37" height="15" /></a></div>';
        str += '                                                    </td>';
        str += '                                                    <td width="50" height="22" valign="middle">';
        str += '                                                        <div align="right">';
        str += '                                                            <a href="javascript:void(0)" onclick="BackPage(\'GetModelList\')"><img src="../../img/back.gif" border="0" width="43" height="15" /></a></div>';
        str += '                                                    </td>';
        str += '                                                    <td width="54" height="22" valign="middle">';
        str += '                                                        <div align="right">';
        str += '                                                            <a href="javascript:void(0)" onclick="NextPage(\'GetModelList\')"><img src="../../img/next.gif" border="0" width="43" height="15" /></a></div>';
        str += '                                                    </td>';
        str += '                                                    <td width="49" height="22" valign="middle">';
        str += '                                                        <div align="right">';
        str += '                                                            <a href="javascript:void(0)" onclick="LastPage(\'GetModelList\')"><img src="../../img/last.gif" border="0" width="37" height="15" /></a></div>';
        str += '                                                    </td>';
        str += '                                                    <td width="59" height="22" valign="middle">';
        str += '                                                        <div align="right">';
        str += '                                                            转到第</div>';
        str += '                                                    </td>';
        str += '                                                    <td width="25" height="22" valign="middle">';
        str += '                                                        <input id="tiao" name="tiao" type="text" style="height: 12px; width: 25px;" size="5" />';
        str += '                                                    </td>';
        str += '                                                    <td width="23" height="22" valign="middle">页</td>';
        str += '                                                    <td width="30" height="22" valign="middle">';
        str += '                                                        <a href="javascript:void(0)" onclick="tiaozhuan_ye(tiao.value)"><img src="../../img/go.gif" width="37" border="0" height="15" /></a>';
        str += '                                                    </td>';
        str += '                                                </tr>';
        str += '                                             </table>';
    }
    str += '                                        </div>';
    str += '                                    </td>';
    str += '                                </tr>';
    
    str += '                            </table>';
    str += '                        </td>';
    str += '                        <td width="14">';
    str += '                            <img src="../../img/tab_22.gif" width="14" height="29" />';
    str += '                        </td>';
    str += '                    </tr>';
    
    str += '                </table>';
    str += '            </td>';
    str += '        </tr>';
    str += '    </table>';
    str += '<div style="width: 100%; background-color:Gray; display:none; height: 100%; position:absolute;  left: 0; top: 0;" id="show1"></div><div style="width: 301px; display:none; height: 143px; position:absolute;  left: 200px; top: 127px;" id="content1"></div>';
    $("YQLJList1").innerHTML = str;
}

//--------------------------------------显示修改框------------------------------------------
function GetList_edit1(id, ModuleName, DisplayOrder,type,active,start_date,end_date) {
    var str1 = "";
    str1 += '<input type="hidden" id="idstr" name="idstr" value="' + id + '"/>';
    str1 += '<input type="hidden" id="midstr" name="midstr" value="' + ModuleName + '"/>';
    str1 += '<input type="hidden" id="orids" name="orids" value="' + DisplayOrder + '"/>';
    str1 += '<table border="0"    cellpadding="0" cellspacing="1" bgcolor="#cccccc" id="move"  style="position:absolute;" width="100%" height="70%">';
    str1 += '<tr bgcolor="#f3ffe3" style="cursor:move;" onmousedown="selectBegin(this);" onmousemove="selectMove(this);" onmouseup="selectEnd(this);"><td colspan="2" align="center" style="height:22px" ><b>编辑</b></td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">调查主题</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="name1" type="text" name="name1" style="width:200px;" value="' + ModuleName + '" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">排序编号</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="num" type="text" name="num" style="width:200px;" value="' + DisplayOrder + '" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">开始时间</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="start_date" type="text" name="start_date" style="width:200px;" value="'+start_date+'" runat="server" onFocus="var end_date=$dp.$(\'end_date\');WdatePicker({onpicked:function(){end_date.focus();}})" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">结束时间</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="end_date" type="text" name="end_date" style="width:200px;" value="'+end_date+'" onFocus="WdatePicker()" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">当前状态</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="qy" type="radio" name="fx" ';
    if (active == "1") {
        str1 += 'checked=true';
    }
    str1 += '/>启用&nbsp;&nbsp;&nbsp;<input id="jy" name="fx" type="radio" ';
    if (active == "0") {
        str1 += 'checked=true';
    }
    str1+=' />禁用';
    str1 += '</td></tr>';

    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">调查类别</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="danx" type="radio" name="lb" ';
    if (type == "1") {
        str1 += 'checked=true';
    }
    str1 += '/>单选&nbsp;&nbsp;&nbsp;<input id="duox" name="lb" type="radio" ';
    if (type == "0") {
        str1 += 'checked=true';
    }
    str1+='/>多选';
    str1 += '</td></tr>';
    
    str1 += '<tr bgcolor="#f3ffe3"><td width="100%" colspan="2" align="center" class="">';
    str1 += '<input type="button" class="" onclick="Edit1(idstr.value,name1.value,num.value,qy.checked,danx.checked,start_date.value,end_date.value)" value="保存"/>&nbsp;&nbsp;<input onclick="back()" type="button" class="" value="取消"/>';
    str1 += '</td></tr></table>';
    $("show1").style.display = "block";
    $("show1").style.filter = "Alpha(Opacity=10)";
    $("content1").style.display = "block";
    $("content1").innerHTML = str1;
}
//---------------------------------------------------------------------------

//--------------------------选择日期操作-------------------------
function quxiao() {
    window.location.href = "YingPinManage.aspx";
}
function clickUp() {
    if (document.all("d5221").value == "") {
        alert("请选择开始日期");
        return false;
    }
    if (document.all("d5222").value == "") {
        alert("请选择结束日期");
        return false;
    }
}
//-----------------------------------------------------------------------

//------------------------------隐藏弹出框------------------------------------------
function back() {
    $("show1").style.display = "none";
    $("content1").style.display = "none";
    $("content1").innerHTML = "";
}
//----------------------------------------------------------------------------------------------

//------------------------------打开子栏目------------------------
function Models(id, name) {
    location.href = SBasePath + "/htm/DiaoCha/DiaoChaList2.htm?parentid=" + id + "&parentname=" + name;
}
//----------------------------------------------

//-----------------------------------------显示新增框------------------------------------------------
function GetList_add1(num1) {
    var str1 = "";
    str1 += '<table border="0"    cellpadding="0" cellspacing="1" bgcolor="#cccccc" id="move"  style="position:absolute;" width="100%" height="70%">';
    str1 += '<tr bgcolor="#f3ffe3" style="cursor:move;" onmousedown="selectBegin(this);" onmousemove="selectMove(this);" onmouseup="selectEnd(this);"><td colspan="2" align="center" style="height:22px" ><b>新增</b></td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">调查主题</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="name1" type="text" name="name1" style="width:200px;" value="" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">排序编号</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="num" type="text" name="num" style="width:200px;" value="'+num1+'" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">开始时间</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="start_date" type="text" name="start_date" style="width:200px;" value="" runat="server" onFocus="var end_date=$dp.$(\'end_date\');WdatePicker({onpicked:function(){end_date.focus();}})" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">结束时间</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="end_date" type="text" name="end_date" style="width:200px;" value="" onFocus="WdatePicker()" />';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">当前状态</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="qy" type="radio" name="fx" checked=true/>启用&nbsp;&nbsp;&nbsp;<input id="jy" name="fx" type="radio" />禁用';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="30%" align="center" class="">调查类别</td>';
    str1 += '<td width="70%" class="" align="center">';
    str1 += '<input id="danx" type="radio" name="lb" checked=true/>单选&nbsp;&nbsp;&nbsp;<input id="duox" name="lb" type="radio" />多选';
    str1 += '</td></tr>';
    str1 += '<tr bgcolor="#f3ffe3"><td width="100%" colspan="2" align="center" class="">';
    str1 += '<input type="button" class="" onclick="Save_add1(name1.value,num.value,start_date.value,end_date.value,qy.checked,danx.checked)" value="保存"/>&nbsp;&nbsp;<input onclick="back()" type="button" class="" value="取消"/>';
    str1 += '</td></tr></table>';
    $("show1").style.display = "block";
    $("show1").style.filter = "Alpha(Opacity=10)";
    $("content1").style.display = "block";
    $("content1").innerHTML = str1;
}
//-----------------------------------------------------------------------------------------------

//------------------------------------保存修改设置----------------------------------------------
var bool;
var flg = "1"; //1是向前0是向后
var flg1 = "1"; //1是向前0是向后
function Edit1(id, name, num, bool, bool1, start_date, end_date) {
    if (name == "") {
        MsgDlg("栏目名称不能为空");
        return;
    }
    if (num == "") {
        MsgDlg("排序编号不能为空");
        return;
    }
    if (isNaN(num)) {
        MsgDlg("排序编号应为数字");
        return;
    }
    if (bool == false)
    { flg = "0"; }
    else
    { flg = "1"; }
    if (bool1 == false)
    { flg1 = "0"; }
    else
    { flg1 = "1"; }
    var url = encodeURI(SBasePath + '/action/DiaoCha/DiaoChaEdit1.aspx');
    var pars = encodeURI("?id=" + id + "&name="+name+"&num=" + num + "&fx=" + flg+"&flg1="+flg1+"&start_date="+start_date+"&end_date="+end_date);
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sGetPaiXu, onFailure: fGetPaiXu });

}
function sGetPaiXu(o) {
    var root = o.responseXML.documentElement;
    var flag = GetXmlData(root, "Value");
    page = GetXmlData(root, "Page");
    if (flag == "true") {
        $("show1").style.display = "none";
        $("content1").style.display = "none";
        $("content1").innerHTML = "";
        GetModelList(indexpage);
//        window.top.frames["Content"].location.href = SBasePath + '/htm/Contents/NewsList.htm?page=' + page + '&modelid=' + ModelId + '&key=' + key;
    }
    else {
        MsgDlg(GetMsg("0"));
    }
}
function fGetPaiXu(o) {
}
//--------------------------------------------------------------------------------------------------

//------------------------------------保存新增设置----------------------------------------------
var bool;
var flg = "1"; //1是向前0是向后
var flg1 = "1"; //1是向前0是向后
function Save_add1(name, num, start_date, end_date, bool, bool1) {
    if (name == "") {
        MsgDlg("栏目名称不能为空");
        return;
    }
    if (num == "") {
        MsgDlg("排序编号不能为空");
        return;
    }
    if (isNaN(num)) {
        MsgDlg("排序编号应为数字");
        return;
    }
    if (bool == false)
    { flg = "0"; }
    else
    { flg = "1"; }
    if (bool1 == false)
    { flg1 = "0"; }
    else
    { flg1 = "1"; }
    var url = encodeURI(SBasePath + '/action/DiaoCha/DiaoChaSave1.aspx');
    var pars = encodeURI("?name=" + name + "&num=" + num + "&fx=" + flg + "&flg1=" + flg1 + "&start_date=" + start_date + "&end_date=" + end_date + "&ModelId="+ModelId);
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sGetSave, onFailure: fGetSave });

}
function sGetSave(o) {
    var root = o.responseXML.documentElement;
    var flag = GetXmlData(root, "Value");
    page = GetXmlData(root, "Page");
    if (flag == "true") {
        $("show1").style.display = "none";
        $("content1").style.display = "none";
        $("content1").innerHTML = "";
        GetModelList(indexpage);
    }
    else {
        MsgDlg(GetMsg("0"));
    }
}
function fGetSave(o) {
}
//--------------------------------------------------------------------------------------------------

//---------------------页面跳转-------------利用跳转时判断输入内容的情况是否正确---------------------
function tiaozhuan_ye(ye) {
    if (isNaN(ye)) {
        MsgDlg("请输入数字");
        $("tiao").value = "";
    }
    if (ye > 0 && ye <= PageTotal) {
        GetModelList(ye);
    }
    else
    { MsgDlg("输入的页数超出范围"); }
}
//--------------------------------------------------------------------------------

//--------------------------------确认删除--------------------------------------
function DelModels(ModelIds) {
    if (ModelIds == "ChkAllValue") {
        var idstr = SelectIDs(ModelIds);
        if (idstr.length == 0) {
            MsgDlg(GetMsg("10"));
        }
        else {
            ConfrimDlg(GetMsg("2"), "DelModel('" + idstr + "')");
        }
    } else {
    ConfrimDlg(GetMsg("2"), "DelModel('" + ModelIds + "')");
    }
}

var DelModel = function(ModelIds)//删除
{

    var url = encodeURI(SBasePath + '/action/DiaoCha/DiaoChaDel1.aspx');
    var pars = encodeURI('?idstr=' + ModelIds);
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sDelModel, onFailure: fDelModel });

};

//操作成功
function sDelModel(o) {
    var root = o.responseXML.documentElement;
    var flag = GetXmlData(root, "Value");
    if (flag == "true") {
        GetModelList(indexpage);

    }
    else {
        MsgDlg(GetMsg("0"));
    }
}

//操作失败
function fDelModel(o) {
}


var checkPage = function() {
    var page = document.getElementById("page").value;
    if (isNaN(page) || page == "") {
        MsgDlg('请输入页数！');
        return false;
    }
    return true;
}


///----------------------------------------------------------div拖拽事件-----------------------------------------------------onmousedown="selectBegin(this);" onmousemove="selectMove(this);" onmouseup="selectEnd(this);" 
var theFlag = 0; //操作是否开始(1是；0否)
var theDiv; //拖曳对象
var x = 0; //鼠标按下时的初始x座标
var y = 0; //鼠标按下时的初始y座标
var divTop = 0; //拖曳对象当前的top值
var divLeft = 0; //拖曳对象当前的left值

//鼠标按下事件
function selectBegin(e) {
    theFlag = 1;
    e.setCapture();

    theDiv = document.getElementById("move");
    //鼠标起始值
    x = parseInt(document.body.scrollLeft) + parseInt(event.clientX); //鼠标按下初始x座标值
    y = parseInt(document.body.scrollTop) + parseInt(event.clientY); //鼠标按下初始y座标值
    divTop = parseInt(theDiv.offsetTop); //拖曳对象当前的top值
    divLeft = parseInt(theDiv.offsetLeft); //拖曳对象当前的left值
}
//鼠标移动事件
function selectMove(e) {
    if (theFlag == 1) {
        var mouseX = parseInt(document.body.scrollLeft) + parseInt(event.clientX); //捕获鼠标当前座标
        var mouseY = parseInt(document.body.scrollTop) + parseInt(event.clientY);
        theDiv.style.top = divTop + (mouseY - y); //重置拖曳对象位置
        theDiv.style.left = divLeft + (mouseX - x);
    }
}
//鼠标松开事件
function selectEnd(e) {
    theFlag = 0;
    e.releaseCapture();
}
//-------------------------------------------------------------------------------------------------
